Repository navigation
feat(installer): replay the SOP 「发起 MR」 migration on install and pull - #1010
Robert0622 wants to merge 8 commits into
Conversation
migrations/033_generic_sop_mr_node.sql was not part of scripts/install-schema-extensions.sh, so an existing installation only gained the 「发起 MR」 node when an operator ran it by hand. ./start.sh pull upgraded the image but kept the seven-node templates, and every run still succeeded with its work branch unpushed. The installer and ./start.sh pull now replay it together with 001 and 031. The script is idempotent and rewrites a template only while its node graph and 交付汇总 position are the shipped original, so operator-edited templates and project copies are untouched. Behaviour change: after the upgrade a run of the backend, frontend and defect-fix SOPs needs a Git credential with push access; without one it stops at 发起 MR for a person instead of succeeding.
Robert0622
left a comment
There was a problem hiding this comment.
自动升级会改写部分自定义 SOP,建议先修复。 在 5415a4bc 上,49 个安装器测试通过。我另外用与 Compose 一致的 MySQL 8.4 和迁移前的官方 seed 实测了升级:原版前端和缺陷 SOP 正常从 7 个节点升级到 8 个;有一条自定义连线的后端 SOP 也被改写,产生重复的连线 ID。第二次执行 033 后,重复 ID 仍在。
Robert0622
left a comment
There was a problem hiding this comment.
复审通过 · 99b07457
在真实 MySQL 8.4 上分别回放旧版、额外 e-6、自定义边目标、改过节点以及新安装的种子数据,每组都连续执行迁移两次。原版三个模板均升级为 8 节点、7 条边,e-6 唯一。修改过的模板和新种子逐条比较 SHA-256 一致。安装器 49 项测试通过。
已核对本提交的差异和 GitHub 检查,当前没有发现阻塞合并的问题。
Robert0622
left a comment
There was a problem hiding this comment.
复审通过 · 59d1ada4
在真实 MySQL 8.4 上分别回放旧版、额外 e-6、自定义边目标、改过节点以及新安装的种子数据,每组都连续执行迁移两次。原版三个模板均升级为 8 节点、7 条边,e-6 唯一。修改过的模板和新种子逐条比较 SHA-256 一致。安装器 49 项测试通过。
已核对本提交的差异和 GitHub 检查,当前没有发现阻塞合并的问题。
crispinhu27
left a comment
There was a problem hiding this comment.
初审 #1010(head 59d1ada,merge-base 5fadefc)。
审查范围:完整 PR diff(install-schema-extensions.sh 把 033 加入安装和 pull 回放;033 改为按完整出厂节点和边判断;测试脚本、docs/deployment.md 和 CHANGELOG)。同时查阅了 038 迁移、v0.3.8、v0.4.0 和 head 的 seed、runtime 对 AGENTFLOW_GIT_TOKEN 的处理、目录契约测试,以及 main 在 merge-base 之后的唯一提交 #1151。
验证:bash -n 通过;python3 -m unittest scripts/test-install.py 49 项通过;internal/repo 目录契约测试通过。在真实 MySQL 8.4.7 上按脚本拼接的 SQL 回放,旧版 7 节点模板升级为 8 节点、7 条边,重复执行幂等,产品 SOP 不受影响。GitHub CI 全部 16 项通过。
发现 1 个 P2 问题(详见行内评论):pull 只回放 033,没有回放 038,升级后 MR 角色提示词仍指向始终为空的 $AGENTFLOW_GIT_TOKEN。
合并状态:与当前 main 在 docs/deployment.md 的迁移表(第 1-3 行)有内容冲突,需要合并两边改动后重新提交。
未验证:真实 Agent 执行「发起 MR」的端到端表现;基于 Docker 的 live 安装和 pull 流程(环境中没有 Docker 和平台镜像)。以上不代表代码没有其他缺陷。
crispinhu27
left a comment
There was a problem hiding this comment.
复审结论:APPROVE(head 75086022,base main@edc27c0)
历史问题
- [P2] pull/安装回放了 033 但没有回放 038,升级后 MR 角色提示词仍指向
$AGENTFLOW_GIT_TOKEN:FIXED。在本 head 上用原触发条件复测,上一版 head 做对照,详见原线程。 - 033 改写带自定义
e-6连线的模板时会产生重复边:仍然是修复状态。给generic-backend-delivery加一条clarify→deliver的e-6后,连续执行 033+038 两遍,节点数、边数和 payload 的 SHA-256 都和迁移前一致。出厂模板正常升级为 8 节点。
本次变化:合并提交 7508602。
- 唯一的文本冲突在
docs/deployment.md:保留了主线 #1151 的 009/036 必需迁移行,并把 033/038 并入「已由安装器回放」一行。 - 回放列表变为 seed → 031 → 033 → 038,测试 fixture 和 live 脚本也同步了。
- 这次合并还把 038 的
-mr角色匹配改成了二进制比较(CAST(... AS BINARY))。复测时它在 v0.3.8 seed 和新 seed 上都能命中,重复执行也安全。
已执行的验证(隔离沙箱用户和隔离数据库,不接触任何凭据)
python3 scripts/test-install.py -v:62 项通过,跳过 2 项(需要 Bash 3.2,本环境没有)。两个脚本bash -n检查通过,scripts/check-public.py通过。go vet ./internal/repo/、go test ./internal/repo/通过,其中包括TestPublicCodeSOPsOpenMRBeforeDeliver。- GitHub 检查:core、platform-required、e2e-required、curl-install 等 16 项全部通过。
未覆盖:本沙箱没有 Docker 和 MySQL 8.4,所以没有跑 scripts/test-install-live.sh 和真实的 start.sh pull 端到端流程,也没有用真实 Agent 跑「发起 MR」。CI 的 curl-install 和 e2e 已通过。
What changed
migrations/033_generic_sop_mr_node.sqlwas left out ofscripts/install-schema-extensions.sh, so an existing installation only gained the 「发起 MR」 node when an operator ran the script by hand../start.sh pullupgraded the image but kept the seven-node templates, and every run still succeeded with its work branch unpushed — the behaviour #967 set out to end. Fresh installs were fine because the seed already carries the eight-node graph, which is why the gap only shows up on an upgraded installation.scripts/install-schema-extensions.shnow replays 033 together with the seed and 031 on install and on./start.sh pull. The migration is idempotent and rewrites a template only while its node graph and 交付汇总 position are the shipped original and its 交付汇总 prompt only while unedited, so operator-edited templates and project copies stay as they are; on a fresh install the seed already has the node, so the script is a no-op there.scripts/test-install.pycovers the replay: the pull test asserts the migration reaches MySQL. Dropping 033 from the pipeline makes it fail.Scope
Compatibility
Behaviour change for existing installations: after the upgrade a run of the backend, frontend and defect-fix SOPs needs a Git credential with push access when a repository is bound. Without one the run stops at 发起 MR for a person instead of succeeding with the code left in a workspace that is reclaimed right after. Operators who deliberately want the old graph can keep it by editing the template before upgrading (the script then leaves it alone) or revert the node by hand.
docs/deployment.mdandCHANGELOG.mdno longer describe 033 as a manual step; the manual command is kept for installations already on a newer image. The migration header states the same, and that auto-running it does not touch project copies.Application startup still runs no data migration: only the operator-invoked installer and
./start.sh pullreplay scripts, which is the existing path 001, the seed and 031 already use.Validation
Not run:
bash scripts/test-install-live.sh(needs a locally built platform image),bash scripts/scan-secrets.sh(gitleaks extraction fails in this sandbox:tar: gitleaks: Cannot change ownership to uid 501, gid 50), and a live./start.sh pullagainst a real MySQL volume.Safety